#include "CurrentThread.h"

#include <sys/types.h>

namespace CurrentThread
{
    __thread int t_cachedTid=0;

    void cacheTid()
    {
        if(t_cachedTid==0)
        {
            //通过Linux系统调用，获取当前线程的tid
            t_cachedTid=static_cast<int>(::syscall(SYS_gettid));
        }
    }
}